package cn.hxlc.tie.demo.core.enums;

import cn.hxlc.tie.libs.scanner.stereotype.EnumResource;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.core.enums.IEnum;

@EnumResource
public enum ProductionEnum implements IEnum<Integer> {

    ZZCP(0,"自制成品"),
    ZZBCP(1,"自制半成品"),
    STJG(2,"受托加工"),
    YF(3,"研发"),
    QT(4,"其他");


    @EnumValue
    private final int code;
    private final String descp;

    @Override
    public Integer getValue() {
        return this.code;
    }

    @Override
    public String toString() {
        return this.descp;
    }

    ProductionEnum(final int code, final String descp) {
        this.code = code;
        this.descp = descp;
    }

    public static ProductionEnum toEnum(Integer code) {
        if (null != code) {
            for (ProductionEnum e : ProductionEnum.values()) {
                if (e.getCode()==code) {
                    return e;
                }
            }
        }
        return null;
    }


    public int getCode() {
        return code;
    }
}
